import { _decorator, Component, Node, Collider2D, IPhysics2DContact } from "cc";
const { ccclass, property } = _decorator;
import { BaseReward } from "../BaseReward";
import { BaseBullet } from "../BaseBullet";
import { BulletStateMachine } from "../Bullet/BulletStateMachine";
import { BulletEnum } from "../Enum/BulletEnum";
import DataManager from "../Runtime/DataManager";
import { SpeedBulletState } from "../Bullet/SpeedBulletState";
@ccclass("SpeedBullet")
export class MoreShoot extends BaseReward {
  // 添加触发标志位
  private isTriggered = false;
  // 重写父类方法
  protected onBeginContact(
    selfCollider: Collider2D,
    otherCollider: Collider2D,
    contact: IPhysics2DContact | null
  ) {
    if (this.isTriggered) return;
    this.isTriggered = true;
    BaseBullet.speed += 20;
    // DataManager.Instance.player
    //   .getComponent(BulletStateMachine)
    //   .changeState(BulletEnum.Speed);
  }
}
